class Stack:
	def __init__(self):
		self.arr = []
	def __len__(self):
 		return len(self.arr)
	def append(self, ele):
		self.arr.append(ele)
	def pop(self):
		return self.arr.pop()
	def extend(self, arr):
		arr.reverse()
		for ele in arr:
			self.append(ele)
class FIFOQueue:
	def __init__(self):
		self.arr = []
	def __len__(self):
		return len(self.arr)
	def append(self, ele):
		self.arr = [ele] + self.arr
	def pop(self):
		return self.arr.pop()
	def extend(self, arr):
		for ele in arr:
			self.append(ele)
			
def copy_2darr(arr):
			result = []
			for row in arr:
				result.append([cell for cell in row])
			return result